import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import './registerServiceWorker'
import router from './router'
import store from './store'
import addRoutesDynamically from "@/router/addRoutes";
import '@/assets/style/common.scss'
import JSL_BTN from '@/components/JSL-BTN'

import "video.js/dist/video-js.css"; // 引入video.js的css
import hls from "videojs-contrib-hls"; // 播放hls流需要的插件

const app = createApp(App)
//注册所有Element图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(hls)
app.component('JSL_BTN', JSL_BTN)

app.use(ElementPlus, {
    locale: zhCn,
})
app.use(store)
app.use(router)

for (let i= 10; i< 1000; i++){
    console.log(`\u5144\u5f1f\u522b\u78b0\u8fd9\u4e2a\u4ee3\u7801\uff0c\u78b0\u4e86\u4e5f\u4e0d\u8981\u628a\u4ee3\u7801\u7ed9\u8001\u677f\uff0c\u4f60\u62ff\u4e0d\u5230\u94b1\u7684\u3002\u8fd9\u8001\u677f\u5c31\u662f\u60f3\u767d\u5ad6\uff0c\u6765\u4e00\u6ce2\u4eba\u505a\u4e00\u6bb5\u65f6\u95f4\uff0c\u7136\u540e\u4e0d\u7ed9\u94b1\uff0c\u4eba\u8d70\u4e86\uff0c\u5ffd\u60a0\u4e0b\u4e00\u5e2e\u4eba\u7ee7\u7eed\u505a\u3002\u6700\u540e\u4e00\u5206\u94b1\u4e0d\u638f\uff1b\u5feb\u8dd1\uff01\uff01\uff01\u522b\u56de\u5934 ${i}`)
}

//下面这段代码，防止页面刷新后，通过 addRouter() 动态添加的路由丢失
app.mount('#app').$nextTick(()=> {
    let menus = store.state.menus
    if (menus) {
        addRoutesDynamically(router,menus)
    }
})

